package cn.adelyn.base.auth.feign;

import cn.adelyn.base.api.auth.feign.TokenFeignClient;
import cn.adelyn.base.api.auth.pojo.bo.UserInfoInTokenBO;
import cn.adelyn.base.auth.service.TokenService;
import cn.adelyn.common.core.response.ServerResponseEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TokenFeignController implements TokenFeignClient {

    @Autowired
    private TokenService tokenService;

    @Override
    public ServerResponseEntity<UserInfoInTokenBO> checkToken(String encryptedAccessToken) {
        UserInfoInTokenBO userInfoInTokenBO = tokenService.getUserInfoByToken(encryptedAccessToken, false);
        return ServerResponseEntity.success(userInfoInTokenBO);
    }
}
